Metric and Baseline
A VObject is located at a certain position in a window and occupies some space thereof. This is called the content rectangle specified by its origin and extent. It is stored in the instvar contentRect. The content rectangles of all VObjects contained in a window are calculated when the window is opened the first time and whenever it is resized. During the calculation of the window layout each VObject must calculate its own minimum size which is an instance of the class Metric and which is returned by the method GetMinSize. The available space for a VObject may be greater than its minimum size. In this case the flags eVObjHFixed and eVObjVFixed (see enum VObjFlags) control whether a VObject may be expanded in the respective direction.
VObjects dealing with text are often aligned at their baseline. This is the line below which letters like 'g' descend. The baseline must be calculated by the method Base and also returned by the method GetMinSize as part of the Metric (see above). For example, the class TextItem determines its metric based on the used font and the string to be shown.
See also technote Layout Management.
Layout and VObject Tree
Complex window layouts are built by combining several VObjects into a single, composite object which can be treated as one VObject. The composite object can again be a part of another composite object, and so on. Therefore the VObjects in a window are organized in a tree-like fashion.
The abstract class CompositeVObject manages a list of VObjects and applies methods executed on itself to all of its components. The actual layout management is up to its subclasses. They have to override the method GetMinSize, the method SetOrigin and the method SetExtent in order to divide the available space between their components; e.g. the class Cluster aligns VObjects within rows and columns. Another example for a composite VObject is the class VObjectPair that arranges two VObjects horizontally.
See also technote Layout Management.
Drawing
ET++ uses an indirect drawing scheme which consists of two steps: invalidation and drawing. The application announces which objects must be redrawn by calling the method ForceRedraw or the method InvalidateRect. The window collects the invalidated areas and redraws them after the next input event is processed. The method UpdateEvent can be used to force any pending update to be done immediately.
The actual drawing must be done in the method Draw which is called when the invalid regions of a window are updated. Drawing occurs on output ports and the class Port provides a rich set of device-independent methods for graphics primitives such as lines, rectangles, ovals, polygons, bitmaps, and more.
If a VObject is selected (e.g. a menu item), then it should be highlighted somehow in order to give a feedback to the user. Highlighting is done by the method DrawHighlight which, by default, draws the VObject in a different color, respectively inverts it on monochrome screens.
See also technote Invalidation and Drawing and technote Drawing Model.
Event Dispatching
If the mouse cursor is located over a VObject, then this VObject gets all mouse and keyboard events. Events are distributed by the window with instances of the class Token. The method DispatchEvents examines the input token and dispatches it to the corresponding Do...Command methods, such as the method DoLeftMouseButtonDownCommand or the method DoKeyCommand. The default action of these methods is to propagate the event up in the VObject tree to the instvar container. In order to react to a specific event the corresponding method must be overridden.
See also technote Event Handling.
Menu
When the right mouse button is pressed while the mouse cursor is over a VObject, then a popup menu is displayed at the current mouse position. The menu is created and menu commands can be processed by overriding the methods: method GetMenu, method DoCreateMenu, method DoSetupMenu and method DoMenuCommand. The default action of these methods is to forward the method to the next event handler which is the instvar container, by default.
See cookbook Menus and technote Event Handling for details.
classes are always derived from VObject.
class VObject
is never reused directly.
class VObject is abstract.
class VObject contains 81 methods.
Graphic Foundation